#!/bin/bash
pidfile=/dev/shm/.$USER.$1.pid
pid=$(cat $pidfile 2>/dev/null)
while [ -z $pid ]; do
    sleep .01
    pid=$(cat $pidfile 2>/dev/null)
done
rm -f $pidfile
kill $pid 2>/dev/null || exit 0
while true; do
    sleep .01
    kill $pid 2>/dev/null || exit 0
done
